package com.org.entity.sys;

import com.org.entity.base.BaseEntity;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * 字典分类实体
 *
 * @author ghh
 * 2019-6-29 10:00:20
 */
@Data
@Entity
@Table(name = "SYS_DICT_CATEGORY")
public class SysDictCategory extends BaseEntity implements Serializable {

    /**
     * 字典编码
     */
    @Column(name = "CODE")
    @Length(min = 0,max = 64,message = "字典编码不能超过64")
    @NotBlank(message = "字典编码不能为空！")
    private String code;


    /**
     * 字典名称
     */
    @Column(name = "NAME")
    @NotBlank(message = "字典名称不能为空！")
    private String name;


    /**
     * 关联项展示方式：0 列表方式；1 树层级展示
     */
    @Column(name = "ITEM_SHOW_TYPE")
    private int itemShowType;

    /**
     * 创建人
     */
    @Column(name = "ADD_USER_ID")
    private String addUserId;

    /**
     * 创建时间
     */
    @Column(name = "ADD_TIME")
    private Date addTime;

    public Date getAddTime() {
        if (this.addTime == null) {
            this.addTime = new Date();
        }
        return this.addTime;
    }

    /**
     * 修改时间
     */
    @Column(name = "MODIFY_TIME")
    private Date modifyTime;

    public Date getModifyTime() {
        if (this.modifyTime == null){
            this.modifyTime = new Date();
        }
        return this.modifyTime;
    }

    /**
     * 修改人
     */
    @Column(name = "MODIFY_USER_ID")
    private String modifyUserId;

}


